package com.yuexun.dhdoctor.module.personalPlan.model.impl;


import com.yuexun.dhdoctor.module.personalPlan.api.PlanApi;
import com.yuexun.dhdoctor.module.personalPlan.bean.CreatePlanBean;
import com.yuexun.dhdoctor.module.personalPlan.bean.UpdatePlanBean;
import com.yuexun.dhdoctor.module.personalPlan.model.IPlanEdtModel;
import com.yuexun.dhdoctor.util.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by work-jx on 2016/9/7.
 */
public class PlanEdtModel implements IPlanEdtModel {
    private PlanApi api;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginModel.class);

    public PlanApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(PlanApi.class);
        }
    }

    @Override
    public Observable<CreatePlanBean> createMyTask(Map<String, String> praise) {
        api = ApiInstance();
        return api.createMyTask(praise);
    }

    @Override
    public Observable<UpdatePlanBean> updateMyTask(Map<String, String> praise) {
        api = ApiInstance();
        return api.updateMyTask(praise);
    }
}
